home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 52
/
Amiga Format AFCD52 (Issue 136, May 2000).iso
/
-screenplay-
/
hd_installers
/
-whdload-
/
whdload_dev
/
src
/
slave-examples
/
turrican2.asm
< prev
next >
Wrap
Assembly Source File
|
1998-06-22
|
7KB
|
304 lines
;*---------------------------------------------------------------------------
; :Program. turrican2.asm
; :Contents. Slave for "Turrican II"
; :Author. BJ
; :History. 09.07.96 initial
; 14.12.96 rework for public installion release
; 23.12.96 installation improved / using new whdload functions
; 31.08.97 update for key managment and sources
; :Requires. -
; :Copyright. Public Domain
; :Language. 68000 Assembler
; :Translator. Barfly V1.131
; :To Do.
;---------------------------------------------------------------------------*
install ;create install slave
INCDIR Includes:
INCLUDE whdload.i
IFND install
OUTPUT wart:turrican2/turrican2.slave
ELSE
OUTPUT wart:turrican2/install.slave
ENDC
BOPT O+ OG+ ;enable optimizing
BOPT w4- ;disable 64k warnings
SUPER
; DiskFormat:
; Track 0-1 std (512 byte/sec,11 sec/track = 5632 byte/track)
; Track 2-159 (6800 byte/track)
;======================================================================
.base SLAVE_HEADER ;ws_Security + ws_ID
dc.w 4 ;ws_Version
dc.w WHDLF_Disk|WHDLF_NoError ;ws_flags
dc.l $80000 ;ws_BaseMemSize
dc.l $20698 ;ws_ExecInstall
dc.w _Start-.base ;ws_GameLoader
dc.w 0 ;ws_CurrentDir
dc.w 0 ;ws_DontCache
_keydebug dc.b $58 ;ws_keydebug = F9
IFD install
_keyexit dc.b $45 ;ws_keyexit = ESC
ELSE
_keyexit dc.b $59 ;ws_keyexit = F10
ENDC
;======================================================================
DOSCMD "WDate >T:date"
dc.b "$VER:"
INCBIN "T:date"
dc.b 0
;======================================================================
_Start ; A0 = resident loader
;======================================================================
lea (_resload,pc),a1
move.l a0,(a1)
;======================================================================
IFD install ;create installation slave
;======================================================================
;install keyboard quitter
bsr _SetupKeyboard
;magic screen
lea _disk1,a0
lea $61000,a1
bsr _Picture
waitbutton
lea _wait,a0
lea $61000,a1
bsr _Picture
_buffer = $400 ;space for disk directory information
dirsize = $1e0 ;size of directory information
;eigenlichen Loader laden / speichern
MOVE.L #$00060000,a0 ;adr
MOVE.L #$00000800,d1 ;size
MOVE.L #$00000400,d0 ;offset
sub.l a1,a1 ;taglist
movem.l d1/a0,-(a7)
move.l (_resload),a2
jsr (resload_DiskLoadDev,a2)
movem.l (a7)+,d0/a1
lea (_60000),a0
jsr (resload_SaveFile,a2)
;create disk image from orginal disk
;Inhaltsverzeichnis der Diskette lesen
move.l #dirsize,d0 ;size
move.l #2,d1 ;starttrack
move.l #0,d2 ;byteoffset
lea _buffer,a0
lea $dff000,a6
jsr $60394
move.l #dirsize,d0 ;size of directory
lea _buffer+8,a0
moveq #dirsize/16-1,d1
.lp add.l (a0),d0 ;calculate image size
add.w #16,a0
dbf d1,.lp
;Image lesen
move.l #2,d1 ;d1 = starttrack
move.l #0,d2 ;d2 = byteoffset
lea $1000,a0 ;a0 = address
move.l d0,d5 ;d5 = image size
lea $dff000,a6 ;a6 = custom
move.l #53,d3 ;d3 = part tracks
move.l d3,d4
mulu #6800,d4 ;d4 = part size
.2 move.l d4,d0
cmp.l d4,d5
bhi .1
move.l d5,d0
.1 movem.l d0-a6,-(a7)
jsr $60394 ;loader is too stupid for large files !!!
movem.l (a7),d0-a6
move.l a0,a1 ;address
lea (_imagename),a0 ;name
addq.b #1,(1,a0)
move.l (_resload),a2
jsr (resload_SaveFile,a2)
movem.l (a7)+,d0-a6
add.l d3,d1 ;skip read tracks
sub.l d0,d5 ;correct
bne .2
;highscores laden
_highs move.l #"MAIN",d0 ;name
move.l #$c0,d1 ;address
moveq #1,d2
jsr $60164 ;load by name
jsr $c0+$b20 ;load highs
bsr _savehighs
bra _exit
_imagename dc.b "d0",0,0
_disk1 INCBIN pics/pic_disk1.bin
_wait INCBIN pics/pic_waitesc.bin
_colors INCLUDE pics/pic_colors.i
;======================================================================
INCDIR Sources:whdload
INCLUDE keyboard.s
INCLUDE picture.s
;======================================================================
ELSE ;create game slave
;======================================================================
move.l #CACRF_EnableI,d0
move.l d0,d1
jsr (resload_SetCACR,a0)
lea _60000,a0
lea $60000,a1
move.l a1,a2
move.l (_resload),a3
jsr (resload_LoadFileDecrunch,a3)
patch $c0(a2),_1
patch $394(a2),_loadbygeo
patchs $5a(a2),_wait
moveq #0,d0 ;expmem
jmp (a2)
_wait move.w #300,d2
.w waitvb ;wait for end of logo
dbf d2,.w
move.w #$7fff,$dff09a
addq.l #2,(a7)
rts
_1 lea $c0,a0
patch $922(a0),_loadbygeo
patch $b20(a0),_loadhighs
patch $b9e(a0),_savehighs
jmp (a0)
;d0 = size in bytes
;d1 = start track
;d2 = offset track in bytes
;a0 = address
_loadbygeo bsr _kinit
move.l d2,-(a7)
subq.w #2,d1 ;image starts at track 2
mulu #6800,d1
add.l d2,d1 ;offset
exg.l d0,d1
moveq #1,d2 ;disk
move.l a3,-(a7)
move.l (_resload),a3
jsr (resload_DiskLoad,a3)
move.l (a7)+,a3
move.l (a7)+,d2
moveq #0,d0
rts
_kinit movem.l a0-a1,-(a7)
lea (_keyboard,pc),a1
cmp.l $68,a1
beq .q
lea (_realint68,pc),a0
move.l $68,(a0)
move.l a1,$68
.q movem.l (a7)+,a0-a1
rts
_realint68 dc.l 0
_keyboard move.l d0,-(a7)
move.b $bfec01,d0
ror.b #1,d0
not.b d0
cmp.b (_keydebug),d0
bne .1
move.l (a7)+,d0
move.w (a7),(6,a7) ;sr
move.l (2,a7),(a7) ;pc
clr.w (4,a7) ;ext.l sr
bra _debug ;coredump & quit
.1
cmp.b (_keyexit),d0
beq _exit ;exit
move.l (a7)+,d0
move.l (_realint68),-(a7) ;enter orginal rou.
rts
_loadhighs movem.l d0-d1/a0-a2,-(a7)
move.l (_resload),a2
lea _highsname,a0
jsr (resload_GetFileSize,a2)
tst.l d0
beq .end
bsr _crypt
lea _highsname,a0
lea $25e,a1
jsr (resload_LoadFile,a2)
bsr _crypt
.end movem.l (a7)+,d0-d1/a0-a2
rts
;======================================================================
ENDC
;======================================================================
_savehighs movem.l d0-d1/a0-a1,-(a7)
bsr _crypt
move.l #$61*4,d0
lea _highsname,a0
lea $25e,a1
move.l (_resload),a2
jsr (resload_SaveFile,a2)
bsr _crypt
movem.l (a7)+,d0-d1/a0-a1
rts
_crypt lea $25e,a0
move.w #$61*4-1,d0
.lp eor.b d0,(a0)+
dbf d0,.lp
rts
;--------------------------------
_60000 dc.b "60000",0
_highsname dc.b "highs",0
_resload dc.l 0 ;address of resident loader
;--------------------------------
_exit pea TDREASON_OK.w
bra _end
_debug pea TDREASON_DEBUG.w
_end move.l (_resload),-(a7)
addq.l #resload_Abort,(a7)
rts
;======================================================================
END